package android.textIt.frontend.adapter;

import java.util.List;

import android.content.Context;
import android.textIt.R;
import android.textIt.backend.model.User;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class MemberListAdapter extends ArrayAdapter<User> {
	 private Context context;
	 private List<User> items;
	 
   public MemberListAdapter(Context context, List<User> members) {
     super(context, R.layout.li_group_members, members);
     this.context = context;
     this.items = members;
   }

   @Override
   public View getView(int position, View convertView, ViewGroup parent) {
       if (convertView == null) {
           LayoutInflater vi = 
          	 (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
           convertView = vi.inflate(R.layout.li_group_members, null);
       }
       User user = items.get(position);
       TextView tvContact = (TextView) convertView.findViewById(R.id.TxtMemberName);
       tvContact.setText(user.getName());
       
       return convertView;
   }
}
